﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Easy.DAL;
using Easy.Model;

namespace Easy.BLL
{
    public class BusinessUnitBLL
    {
        private readonly BusinessUnitDAL DBConn = new BusinessUnitDAL();
        public bool ModifyBusinessUnitRouter(String OptionType, BusinessUnit businessunit,Guid SystemUserID)
        {
            if (businessunit == null) return false;
            switch (OptionType)
            {
                case "UpdatePreBusinessUnit":
                    {
                        return this.UpdatePreBusinessUnit((Guid)businessunit.BusinessUnitId, (Guid)businessunit.PreBusinessUnit,SystemUserID);
                    }
                case "DeleteBusinessUnit":
                    {
                        return this.DeleteBusinessUnit((Guid)businessunit.BusinessUnitId, SystemUserID);
                    }
                case "UpdateAll": break;
                default: return false;
            }
            return false;
        }
        private bool UpdatePreBusinessUnit(Guid TargetID, Guid NewPreBusinessID,Guid SystemUserID)
        {
            return DBConn.UpdatePreBusinessUnit(TargetID, NewPreBusinessID,SystemUserID) == 1 ? true : false;
        }
        private bool DeleteBusinessUnit(Guid TargetID, Guid SystemUserID)
        {
            return DBConn.DeleteBusinessUnit(TargetID, SystemUserID) == 1 ? true : false;
        }
    }
}
